﻿using System;
using System.Collections.Generic;

namespace YJKRevitDimensionText.OneKeyPlanDim.Utility
{
	public class SortLevelDimDataInfo
	{
		public SortLevelDimDataInfo(List<SingleLevelDimDataInfo> lstSingleLevelDimDataInfo)
		{
			this.m_lstSingleLevelDimDataInfo = lstSingleLevelDimDataInfo;
		}

		public List<SingleLevelDimDataInfo> SingleLevelDimDataInfo
		{
			get
			{
				return this.m_lstSingleLevelDimDataInfo;
			}
		}

		public void SortOperator()
		{
			List<CommonLengthLevelDimDataInfo> list = new List<CommonLengthLevelDimDataInfo>();
			foreach (SingleLevelDimDataInfo singleLevelDimDataInfo in this.m_lstSingleLevelDimDataInfo)
			{
				bool flag = false;
				foreach (CommonLengthLevelDimDataInfo commonLengthLevelDimDataInfo in list)
				{
					if (commonLengthLevelDimDataInfo.IsEqualLadderLineLength(singleLevelDimDataInfo))
					{
						commonLengthLevelDimDataInfo.AddElement(singleLevelDimDataInfo);
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					CommonLengthLevelDimDataInfo item = new CommonLengthLevelDimDataInfo(singleLevelDimDataInfo);
					list.Add(item);
				}
			}
			list.Sort(new CommonLengthLocationComparer());
			this.m_lstSingleLevelDimDataInfo.Clear();
			foreach (CommonLengthLevelDimDataInfo commonLengthLevelDimDataInfo2 in list)
			{
				commonLengthLevelDimDataInfo2.SortOperator();
				foreach (CommonDirectionLevelDimDataInfo commonDirectionLevelDimDataInfo in commonLengthLevelDimDataInfo2.SortlstCommonDirectionLevelDimDataInfo)
				{
					commonDirectionLevelDimDataInfo.SortOperator();
					this.m_lstSingleLevelDimDataInfo.AddRange(commonDirectionLevelDimDataInfo.SortSingleLevelDimDataInfo);
				}
			}
		}

		private void MergeStepDownDim()
		{
		}

		private List<SingleLevelDimDataInfo> m_lstSingleLevelDimDataInfo = new List<SingleLevelDimDataInfo>();
	}
}
